import json

from selenium import webdriver


class DriverUtils:
    __driver = None

    @classmethod
    def open_deriver(cls):
        if cls.__driver is None:
            cls.__driver = webdriver.Chrome()
            cls.__driver.maximize_window()
        return cls.__driver

    @classmethod
    def quit_driver(cls):
        if cls.__driver is not None:
            cls.__driver.quit()
            cls.__driver = None


class ReadDataUtils:

    def read_jsonData(self, file):
        with open(file, "r", encoding="utf-8") as f:
            jsonData = json.load(f)
            listData = []
            for x in jsonData:
                temp = tuple(x.values())
                listData.append(temp)
            return listData


if __name__ == '__main__':
    DriverUtils.quit_driver()
    a = DriverUtils.open_deriver()
    a.get("https://www.baidu.com")
    DriverUtils.quit_driver()
    a = ReadDataUtils().read_jsonData(r"C:\Users\sheng\PycharmProjects\UI_code11\data\add_vip_data.json")
    print(a)